<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>str_replace 的忽略大小写版本</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.str-getcsv.html">str_getcsv</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.str-pad.html">str_pad</a></div>
 <div class="up"><a href="ref.strings.html">字符串函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.str-ireplace" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">str_ireplace</h1>
  <p class="verinfo">(PHP 5)</p><p class="refpurpose"><span class="refname">str_ireplace</span> &mdash; <span class="dc-title"><span class="function"><a href="function.str-replace.html" class="function">str_replace()</a></span> 的忽略大小写版本</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.str-ireplace-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <span class="methodname"><strong>str_ireplace</strong></span>
    ( <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$search</code></span>
   , <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$replace</code></span>
   , <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$subject</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter reference">&$count</code></span>
  ] )</div>

  <p class="para rdfs-comment">
      该函数返回一个字符串或者数组。该字符串或数组是将 <em><code class="parameter">subject</code></em> 中全部的 <em><code class="parameter">search</code></em> 都被 <em><code class="parameter">replace</code></em> 替换（忽略大小写）之后的结果。如果没有一些特殊的替换规则，你应该使用该函数替换带有 <em>i</em> 修正符的 <span class="function"><a href="function.preg-replace.html" class="function">preg_replace()</a></span> 函数。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.str-ireplace-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">search</code></em></dt>

     <dd>

      <blockquote class="note"><p><strong class="note">Note</strong>: 
       <p class="para">
        <em><code class="parameter">search</code></em> 元素的每次替换都是基于前一次替换结果的。
       </p>
      </p></blockquote>
     </dd>

    
    
     <dt>
<em><code class="parameter">replace</code></em></dt>

     <dd>

      <p class="para">
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">subject</code></em></dt>

     <dd>

      <p class="para">
       如果 <em><code class="parameter">subject</code></em> 是一个数组，替换操作将遍历整个 <em><code class="parameter">subject</code></em>，并且也将返回一个数组。
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">count</code></em></dt>

     <dd>

      <p class="para">
       <em><code class="parameter">needles</code></em> 的匹配和替换数量将在 <em><code class="parameter">count</code></em> 中返回，它是以引用方式传递的。
      </p>
     </dd>

    
   </dl>

  </p>
  <p class="para">
   如果 <em><code class="parameter">search</code></em> 和 <em><code class="parameter">replace</code></em> 为数组，那么 <span class="function"><a href="function.str-replace.html" class="function">str_replace()</a></span> 将对 <em><code class="parameter">subject</code></em> 做二者的映射替换。如果 <em><code class="parameter">replace</code></em> 的值的个数少于 <em><code class="parameter">search</code></em> 的个数，多余的替换将使用空字符串来进行。如果 <em><code class="parameter">search</code></em> 是一个数组而 <em><code class="parameter">replace</code></em> 是一个字符串，那么 <em><code class="parameter">search</code></em> 中每个元素的替换将始终使用这个字符串。
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.str-ireplace-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   返回替换后的字符串或者数组。
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.str-ireplace-changelog">
  <h3 class="title">更新日志</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>版本</th>
       <th>说明</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>5.0.0</td>
       <td>
        新增 <em><code class="parameter">count</code></em> 参数。
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.str-ireplace-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-4777">
    <p><strong>Example #1 <span class="function"><strong>str_ireplace()</strong></span> 范例</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$bodytag&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">str_ireplace</span><span style="color: #007700">(</span><span style="color: #DD0000">"%body%"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"black"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"&lt;body&nbsp;text=%BODY%&gt;"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.str-ireplace-notes">
  <h3 class="title">注释</h3>
  <blockquote class="note"><p><strong class="note">Note</strong>: <span class="simpara">此函数可安全用于二进制对象。</span></p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.str-ireplace-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.str-replace.html" class="function" rel="rdfs-seeAlso">str_replace()</a> - 子字符串替换</span></li>
    <li class="member"><span class="function"><a href="function.preg-replace.html" class="function" rel="rdfs-seeAlso">preg_replace()</a> - 执行一个正则表达式的搜索和替换</span></li>
    <li class="member"><span class="function"><a href="function.strtr.html" class="function" rel="rdfs-seeAlso">strtr()</a> - 转换指定字符</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.str-getcsv.html">str_getcsv</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.str-pad.html">str_pad</a></div>
 <div class="up"><a href="ref.strings.html">字符串函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
